<?php
namespace Help\Controller;
use Think\Controller;
class IndexController extends Controller {
    public function index(){
        $content=I('content');
        if($content!='')
        {
            $data=array(
                'content'=>$content,
                'time'=>date('Y-m-d H:i',time())
            );

            $help=M('help')->add($data);
            if(!$help )
            {
                $result=array(
                    'code'=>'0',
                    'message'=>'留言失败，请重新输入'
                );
            }else{
                $result=array(
                    'code'=>'1',
                    'message'=>'成功留言'
                );
            }
        }else
        {
            $result=array(
                'code'=>'2',
                'message'=>'内容不能为空'
            );
        }
        echo json_encode($result,JSON_UNESCAPED_UNICODE);
    }
}